package IC.lir.Instrunction;

public class BinaryLogicalInstruction extends Instruction {
	

	private Data _firstOperand;
	private Register _secondOperand;
	private Operation _opertaion;
	
	public BinaryLogicalInstruction(Operation op, Data first, Register second)
	{
		_firstOperand = first;
		_secondOperand = second;
		_opertaion = op;
	}
	
	public String toString()
	{
		return String.format("%s %s,%s", _opertaion.toString(), _firstOperand.toString(), _secondOperand.toString());
	}
	
	public enum Operation
	{
		Not("Not", 0),
		And("And", 1),
		Or("Or", 2),
		Xor("Xor", 3),
		Compare("Compare", 4);
		
		private int _index;
		private String _str;
		
		private Operation(String str, int index)
		{
			_index = index;
			_str = str;
		}
		
		public String toString() { return new String(_str); }
		public boolean Equals(Operation op) { return _index == op._index; }
	}

}
